import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
      home: Scaffold(
    appBar: AppBar(
      title: const Text("你好flutter"),
    ),
    body: const MyApp(),
  )));
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const Row(
      children: [
        Expanded(
          flex: 2,
          child: IconButton(
            icon: Icons.shop,
            color: Colors.lightBlue,
          ),
        ),
        Expanded(
          flex: 1,
          child: IconButton(
            icon: Icons.fire_truck,
            color: Colors.red,
          ),
        ),
      ],
    );
  }
}

class IconButton extends StatelessWidget {
  final Color color;
  final double size;
  final IconData icon;
  const IconButton(
      {super.key,
      required this.icon,
      this.color = Colors.blue,
      this.size = 32.0});

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 100.0,
      width: 100.0,
      color: color,
      child: Center(
        child: Icon(icon, size: size, color: Colors.white),
      ),
    );
  }
}
